package com.tedu.goods.service;

import com.tedu.goods.dao.GoodsDao;
import com.tedu.goods.pojo.Goods;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author Song
 * @since 2020/9/30
 */
@Service
public class GoodsServiceImpl implements GoodsService{

    private static final Logger log = LoggerFactory.getLogger(GoodsServiceImpl.class);

    @Autowired
    GoodsDao goodsDao;

    @Override
    public List<Goods> findGoods() {
        log.info("findGoods()");
        return goodsDao.findGoods();
    }

    @Override
    public int deleteById(Integer id) {
        log.info("deleteById()");
        return goodsDao.deleteById(id);
    }

    @Override
    public int saveGoods(Goods entity) {
        log.info("saveGoods()");
        return goodsDao.insertObject(entity);
    }

    @Override
    public Goods findById(Integer id) {
        log.info("findById()");
        return goodsDao.findById(id);
    }

    @Override
    public int updateGoods(Goods goods) {
        log.info("updateGoods()");
        return goodsDao.updateGoods(goods);
    }
}
